package net.ktims.khub.runtime;



import net.ktims.khub.IWebService;
import net.ktims.khub.WebService;
import oracle.j2ee.ws.common.encoding.*;
import oracle.j2ee.ws.client.ServiceExceptionImpl;
import oracle.j2ee.ws.common.util.exception.*;
import oracle.j2ee.ws.common.soap.SOAPVersion;
import oracle.j2ee.ws.client.HandlerChainImpl;
import javax.xml.rpc.*;
import javax.xml.rpc.encoding.*;
import javax.xml.rpc.handler.HandlerChain;
import javax.xml.rpc.handler.HandlerInfo;
import javax.xml.namespace.QName;

public class WebService_Impl extends oracle.j2ee.ws.client.BasicService implements WebService {
    private static final QName serviceName = new QName("http://192.168.0.2/", "WebService");
    private static final QName ns1_IWebServicePort_QNAME = new QName("http://192.168.0.2/", "IWebServicePort");
    private static final Class IWebService_PortClass = IWebService.class;
    
    public WebService_Impl() {
        super(serviceName, new QName[] {
                        ns1_IWebServicePort_QNAME
                    },
            new WebService_SerializerRegistry().getRegistry());
        
    }
    
    public java.rmi.Remote getPort(QName portName, Class serviceDefInterface) throws javax.xml.rpc.ServiceException {
        try {
            if (portName.equals(ns1_IWebServicePort_QNAME) &&
                serviceDefInterface.equals(IWebService_PortClass)) {
                return getIWebServicePort();
            }
        } catch (Exception e) {
            throw new ServiceExceptionImpl(new LocalizableExceptionAdapter(e));
        }
        return super.getPort(portName, serviceDefInterface);
    }
    
    public java.rmi.Remote getPort(Class serviceDefInterface) throws javax.xml.rpc.ServiceException {
        try {
            if (serviceDefInterface.equals(IWebService_PortClass)) {
                return getIWebServicePort();
            }
        } catch (Exception e) {
            throw new ServiceExceptionImpl(new LocalizableExceptionAdapter(e));
        }
        return super.getPort(serviceDefInterface);
    }
    
    public IWebService getIWebServicePort() {
        String[] roles = new String[] {};
        HandlerChainImpl handlerChain = new HandlerChainImpl(getHandlerRegistry().getHandlerChain(ns1_IWebServicePort_QNAME));
        handlerChain.setRoles(roles);
        IWebServicePortBinding_Stub stub = new IWebServicePortBinding_Stub(handlerChain);
        try {
            stub._initialize(super.internalTypeRegistry);
        } catch (JAXRPCException e) {
            throw e;
        } catch (Exception e) {
            throw new JAXRPCException(e.getMessage(), e);
        }
        return stub;
    }
}
